package com.hilin.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hilin.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author qhl
 * @since 2021-12-03
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel("机构表")
@TableName("org_info")
public class OrgInfoPo extends BaseEntity<OrgInfoPo> {

    public static final String ORG_NODE_NAME = "<%s>";
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("机构id")
    @TableId(value = "org_id", type = IdType.AUTO)
    private Long orgId;
    @ApiModelProperty("机构名称")
    @TableField("org_name")
    private String orgName;
    @ApiModelProperty("机构验证字符串")
    @TableField("org_secret")
    private String orgSecret;
    @ApiModelProperty("父机构id")
    @TableField("org_pid")
    private Long orgPid;
    @ApiModelProperty("父机构名称")
    @TableField("org_pname")
    private String orgPname;
    @ApiModelProperty("存放所有父机构节点id;父节点用'<'和'>'包裹，例如<1><11>")
    @TableField("org_nodes")
    @JsonIgnore
    private String orgNodes;
    @ApiModelProperty("机构额外字段;查询时使用'extra.字段名'进行查询")
    @TableField("org_extra")
    private String orgExtra;
    @ApiModelProperty("机构状态;1启用   2禁用   3删除")
    @TableField("org_status")
    private Integer orgStatus;
    @ApiModelProperty("机构坐标")
    @TableField("org_lat")
    private Double orgLat;
    @ApiModelProperty("机构坐标")
    @TableField("org_lng")
    private Double orgLng;
    @ApiModelProperty("机构地址")
    @TableField("org_address")
    private String orgAddress;
    @ApiModelProperty("机构电话")
    @TableField("org_phone")
    private String orgPhone;
    @ApiModelProperty("创建人")
    private String creator;
    @ApiModelProperty("创建人类型")
    @TableField("creator_type")
    private String creatorType;
    @ApiModelProperty("创建时间")
    @TableField("creator_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date creatorTime;
    @ApiModelProperty("更新人")
    private String updator;
    @ApiModelProperty("更新人类型")
    @TableField("updator_type")
    private String updatorType;
    @ApiModelProperty("更新时间")
    @TableField("updator_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatorTime;

    public OrgInfoPo like(OrgInfoPo like) {
        setLikeCondition(like);
        return this;
    }
}